<?php
/**
 *
 * @author ninetyseven.
 * @date 2023-03-27 22:19
 */

namespace App\Services\Factory\login;

use App\Enum\TravelEnum;
use App\Services\DonationService;
use App\Services\DriverService;
use App\Services\MemberCommitteeService;
use App\Services\NullService;
use App\Services\VillageCommitteeService;
use App\Services\VillagerUserService;
use App\Services\VolunteerService;
use Illuminate\Support\Facades\Log;

class Factory
{
    /**
     * 入口
     * @param $type
     * @return
     * @throws \Exception
     * @author ninetyseven.
     * @date 2023-03-27 22:54
     */
    public static function create($type)
    {
        $obj = null;
        switch ($type) {
            case TravelEnum::PLATFORM_VILLAGER:
                //村民
                $obj = new VillagerUserService();
                break;
            case TravelEnum::PLATFORM_VILLAGER_COMMITTEE:
                //村委会
                $obj =  new VillageCommitteeService();
                break;
            case TravelEnum::PLATFORM_MEMBER_VILLAGER:
                //居委会
                $obj =  new MemberCommitteeService();
                break;
            case TravelEnum::PLATFORM_DONATION:
                //捐赠
                $obj =  new DonationService();
                break;
            case TravelEnum::PLATFORM_DRIVER:
                //司机
                $obj =  new DriverService();
                break;
            case TravelEnum::PLATFORM_VOLUNTEER:
                //志愿者
                $obj =  new VolunteerService();
                break;
            default:
                $obj = new NullService();
                break;
        }
        return $obj;
    }
}
